<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<div class="row">
<form class="form-inline" role="form">
   <div class="form-group">
      <label class="sr-only" for="name">商品模糊搜索：</label>
      <input type="text" class="form-control" id="name" 
         placeholder="请输入商品名称">
   </div>
   <button type="button" class="btn btn-default" id="btn-product">提交</button>
</form>
</div>
<div class="row">
	<ul class="list-group banner_product">
	
	</ul>
</div>
<script>
$(".modal-title").html("商品");
var obj = $(".banner_product");
// load product
$("#btn-product").click(function(){
	var name = $("#name").val();
	if(name == ""){
		alert("商品名称没有输入！");
		return;
	}
	obj.empty();
	$.post(ctx+"/product/search/name",{
		name:name
	},function(result){
		var array = result.data;
		 for(var i = 0 ; i < array.length ; i ++){
			 obj.append("<li class='list-group-item' onclick='selectProduct("+array[i].productId+")'>"+array[i].manufacture+"</li>");
		 }
	});
});

function selectProduct(productId){
	$("input[name='bannerValue']").val(productId);
}

</script>